Transaction.cls
Language: Visual Basic Class
Last Modified: 2020-06-27 1:58:30 PM UTC
File Size: 1058 bytes
Last Modified: 2020-06-27 1:58:30 PM UTC
File Size: 1058 bytes
http://www.penguinstew.ca/example/ExcelSQLExport/Transaction.cls
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Transaction"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'Represents transaction data
Public MonthId As Integer
Public TransDate As Date
Public Description As String
Public amount As Double
Public CatagoryId As Integer
Public RecurringExpenseId As Integer
Public SpecialAccountId As Integer
'Formats the object into an SQL insert statement
Public Function ToSQL() As String
Dim specialAccount As String
If SpecialAccountId = 0 Then
specialAccount = "null"
Else
specialAccount = SpecialAccountId
End If
ToSQL = "INSERT INTO [Transactions]([MonthId], [Date], [Description], [Amount], [CategoryId], [RecurringExpenseMonthId], [SpecialAccountMonthId]) VALUES (" & Me.MonthId & ",'" & Format(Me.TransDate, "yyyy-mm-dd") & "','" & Me.Description & "'," & Me.amount & "," & Me.CatagoryId & ",null," & specialAccount & ")"
End Function
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30